# utf-8
import os
class Confg(object):

    def __init__(self):
        # 暂未启用
        self.dbName = "video_log"
        # 视频文件下载地址
        self.videoDownloadDir = "tmp_video_download"
        # 待上传文件生成
        self.videoConfigDir = "tmp_video_json_file"
        self.youtube_json_file = '/config/client_secret.json'



    def get_root_dir(self):
        """
        获取保存视频的目录
        :return:
        """
        return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

    def get_video_dir(self):
        '''
        获取 视频存放路径
        :return:
        '''
        videoDownloadDir = self.get_root_dir()+"/"+self.videoDownloadDir
        if os.path.isdir(videoDownloadDir) == False:
            os.makedirs(videoDownloadDir)
        return videoDownloadDir

    def get_config_json_dir(self):
        '''
        获取google的youtube账号json授权文件地址
        :return:
        '''
        return self.get_root_dir() + self.youtube_json_file

    def get_video_config_dir(self):
        '''
        获取视频文件生成json文件目录
        :return:
        '''
        full_path = self.get_root_dir() + "/" + self.videoConfigDir
        if os.path.isdir(full_path) == False:
            os.makedirs(full_path)
        return full_path



if __name__ == '__main__':
    configLib = Confg()
    print(configLib.get_video_dir())
    print(configLib.get_config_json_dir())